<?php

/**
 * This is the model class for table "efl".
 *
 * The followings are the available columns in table 'efl':
 * @property integer $id
 * @property string $name
 * @property string $sex
 * @property string $email
 * @property string $contact_number
 * @property string $country_of_origin
 * @property string $institution_school
 * @property string $current_position
 * @property string $options
 * @property string $date_of_payment
 * @property string $payment_in
 * @property string $date_of_arrival
 * @property string $date_of_departure
 */
class Efl extends CActiveRecord
{
	public $verifyCode;

	/**
	 * Returns the static model of the specified AR class.
	 * @return Efl the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'efl';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('name, sex, email, contact_number, country_of_origin, institution_school, current_position, options, date_of_payment, payment_in, date_of_arrival, date_of_departure', 'required'),
			array('email', 'email', 'message' => 'Please enter a valid email address.'),
			array('name, sex, email, contact_number, country_of_origin, institution_school, current_position, options, date_of_payment, payment_in, date_of_arrival, date_of_departure', 'length', 'max'=>500),
			array('verifyCode', 'CaptchaExtendedValidator', 'allowEmpty'=>!CCaptcha::checkRequirements()),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, name, sex, email, contact_number, country_of_origin, institution_school, current_position, options, date_of_payment, payment_in, date_of_arrival, date_of_departure', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'name' => 'Name',
			'sex' => 'Sex',
			'email' => 'Email',
			'contact_number' => 'Contact Number',
			'country_of_origin' => 'Country Of Origin',
			'institution_school' => 'Institution / School',
			'current_position' => 'Current Position',
			'options' => 'Options',
			'date_of_payment' => 'Date Of Payment',
			'payment_in' => 'Payment In',
			'date_of_arrival' => 'Date Of Arrival',
			'date_of_departure' => 'Date Of Departure',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('name',$this->name,true);
		$criteria->compare('sex',$this->sex,true);
		$criteria->compare('email',$this->email,true);
		$criteria->compare('contact_number',$this->contact_number,true);
		$criteria->compare('country_of_origin',$this->country_of_origin,true);
		$criteria->compare('institution_school',$this->institution_school,true);
		$criteria->compare('current_position',$this->current_position,true);
		$criteria->compare('options',$this->options,true);
		$criteria->compare('date_of_payment',$this->date_of_payment,true);
		$criteria->compare('payment_in',$this->payment_in,true);
		$criteria->compare('date_of_arrival',$this->date_of_arrival,true);
		$criteria->compare('date_of_departure',$this->date_of_departure,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}